package com.n5x.model.user;

import com.n5x.model.AbstractModel;
import com.n5x.model.discount.DiscountCash;
import com.n5x.model.discount.DiscountGift;

import java.math.BigDecimal;
import java.util.Date;

public class UserDisCount extends AbstractModel {

    private UserDisCount() {
    }

    public UserDisCount(UserInfo userInfo, DiscountCash discountCash) {
        this.fkUser = userInfo.getId();
        this.fkDiscountId = discountCash.getId();
        this.discountType = DiscountType.现金优惠.name();
        this.discountName = discountCash.getName();
        this.discountTargetPrice = discountCash.getTargetPrice();
        this.discountPrice = discountCash.getPrice();
        this.discountVaildTime = discountCash.getVaildTime();
        this.discountContent = discountCash.getContent();
    }

    public UserDisCount(UserInfo userInfo, DiscountGift discountGift) {
        this.fkUser = userInfo.getId();
        this.fkDiscountId = discountGift.getId();
        this.discountType = DiscountType.礼品优惠.name();
        this.discountName = discountGift.getName();
        this.discountTargetPrice = discountGift.getTargetPrice();
        this.discountPrice = discountGift.getPrice();
        this.discountVaildTime = discountGift.getVaildTime();
        this.discountName = discountGift.getName();
    }

    /**
     * 优惠类型
     */
    public enum DiscountType {
        现金优惠, 礼品优惠
    }

    /**
     * 关联现金优惠或礼品优惠
     */
    private String fkDiscountId;

    /**
     * 优惠类型
     */
    private String discountType;

    /**
     * 关联会员用户
     */
    private String fkUser;

    /**
     * 领取日期
     */
    private Date receiptTime = new Date();

    /**
     * 使用日期
     */
    private Date useTime;

    /**
     * 优惠名称
     */
    private String discountName;

    /**
     * 优惠目标金额
     */
    private BigDecimal discountTargetPrice;

    /**
     * 优惠金额
     */
    private BigDecimal discountPrice;

    /**
     * 优惠有效期
     */
    private Date discountVaildTime;

    /**
     * 优惠介绍
     */
    private String discountContent;

    public String getFkDiscountId() {
        return fkDiscountId;
    }

    public void setFkDiscountId(String fkDiscountId) {
        this.fkDiscountId = fkDiscountId;
    }

    public String getDiscountType() {
        return discountType;
    }

    public void setDiscountType(String discountType) {
        this.discountType = discountType;
    }

    public String getFkUser() {
        return fkUser;
    }

    public void setFkUser(String fkUser) {
        this.fkUser = fkUser;
    }

    public Date getReceiptTime() {
        return receiptTime;
    }

    public void setReceiptTime(Date receiptTime) {
        this.receiptTime = receiptTime;
    }

    public Date getUseTime() {
        return useTime;
    }

    public void setUseTime(Date useTime) {
        this.useTime = useTime;
    }

    public String getDiscountName() {
        return discountName;
    }

    public void setDiscountName(String discountName) {
        this.discountName = discountName;
    }

    public BigDecimal getDiscountTargetPrice() {
        return discountTargetPrice;
    }

    public void setDiscountTargetPrice(BigDecimal discountTargetPrice) {
        this.discountTargetPrice = discountTargetPrice;
    }

    public BigDecimal getDiscountPrice() {
        return discountPrice;
    }

    public void setDiscountPrice(BigDecimal discountPrice) {
        this.discountPrice = discountPrice;
    }

    public Date getDiscountVaildTime() {
        return discountVaildTime;
    }

    public void setDiscountVaildTime(Date discountVaildTime) {
        this.discountVaildTime = discountVaildTime;
    }

    public String getDiscountContent() {
        return discountContent;
    }

    public void setDiscountContent(String discountContent) {
        this.discountContent = discountContent;
    }
}